package com.es.test;

import com.sun.security.auth.login.ConfigFile;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.Reader;

/**
 * 描述:
 * MyBatis-
 *
 * @author Derek
 * 创建时间：2022-05-05 11:24
 */
public class App {
    String configFile = "mybatis-config.xml";
    @Test
    public void testSession() throws IOException {
        Reader reader = Resources.getResourceAsReader(configFile);
        SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
        SqlSessionFactory factory = builder.build(reader);
        SqlSession session = factory.openSession();
        System.out.println(session);
    }
}
